package com.fuego.creditsystemnews.controller;


import com.fuego.creditsystemnews.service.INewsTypeService;
import jakarta.annotation.Resource;
import org.example.dto.Result;
import org.example.entity.NewsType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RestController
@RequestMapping("/news-type")
public class NewsTypeController {
    @Resource
    private INewsTypeService newsTypeService;

    @GetMapping("list")
    public Result queryTypeList() {
//        return newsTypeService.queryTypeList();
        List<NewsType> typeList = newsTypeService.query().orderByAsc("sort").list();
        return Result.ok(typeList);
    }
}
